﻿// Module:             Games Programming
// Assignment1:        Platformer Game
// Add game feature:   Platform
// Student Number:     S10096666C
// Student Name:       Trinh Quang Anh

//////////////////////////////////////////////////////////////////////////

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Game
{
    public enum PlatformType
    {
        Start = 1,
        Exit,
        Flat,
        Lift,
        Ladder,
        Portal,
        Catapult,
        Trampoline,
        Glider
    }

    public class Platform
    {
        private Vector2 _position;
        private readonly PlatformType _type;

        private readonly Texture2D _texture;
        private readonly int _width;
        private readonly int _height;

        private readonly Rectangle _boundingRect;

        public Platform(PlatformType type, Texture2D texture, int x, int y)
        {
            _type = type;
            _texture = texture;
            _width = texture.Width;
            _height = texture.Height;
            _position = new Vector2(x * Game1.GridSize, y * Game1.GridSize);

            _boundingRect = new Rectangle(x * Game1.GridSize, y * Game1.GridSize, _width, _height);
        }

        public Platform(PlatformType type, Texture2D texture, Vector2 pos)
        {
            _type = type;
            _texture = texture;
            _width = texture.Width;
            _height = texture.Height;
            _position = pos;

            _boundingRect = new Rectangle((int)pos.X, (int)pos.Y, _width, _height);
        }

        public PlatformType Type
        {
            get { return _type; }
        }

        public Vector2 Position
        {
            get { return _position; }
        }

        public int Width
        {
            get { return _width; }
        }

        public int Height
        {
            get { return _height; }
        }

        public Rectangle BoundingRect
        {
            get { return _boundingRect; }
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(_texture,_position, Color.White);
        }

        public void Update(GameTime gameTime)
        {
            //throw new System.NotImplementedException();
        }
    }
}
